NEAT Cube Foragers

Neuroevolution of cube-pushing brains. Cubes are nudged face-by-face toward food; fitness is a ratcheted, competition-aware proximity score plus eat bonuses, minus a push cost.

Setup (locked once training starts)

The action decoder assumes the 4 outputs are logistic, i.e. in [0,1]: force is clamped to that range and the face selector bins it. But MOD_ACTIVATION mutates output nodes too by default, and a force output on SINUSOID or BIPOLAR spends much of its range negative — which clamps to exactly zero force, so the cube can never push. Leaving this on keeps output activations logistic while hidden nodes still mutate freely.

Network inputs (locked once training starts)

Input neurons4
If fewer live foods/rivals remain than X, the nearest one is repeated to fill the extra slots (zeros only when none exist). Whiskers are evenly-spread world-frame rays (range 6) sensing obstacles and walls: 0 = clear, →1 at contact. The input layout is stored in saved genome files, so replays wire up correctly.

Run

Training runs the physics as fast as your CPU allows (fixed 60 Hz substeps, so it stays stable). Headless skips all drawing. Training keeps running when this tab is in the background — a worker clock sidesteps the browser's background throttling.

Progress

Modeidle
Generation0
Set
Best fitness (all-time)
Best fitness (last gen)
Mean fitness (last gen)
Sim speed
Green: generation best. Amber: generation mean.

NEAT / Species

Species
Compat. threshold
Best genome size
idsizebestmeanage
Species are clustered by structural compatibility distance (disjoint connection genes + weight difference); the threshold self-tunes toward a healthy species count. During training, cubes are tinted by their genome's species.

Genomes

Loaded genomesnone
One file format for everything: saving from training, from a single inspected cube, or from the ecosystem all produce the same envelope, carrying the sensor spec and settings the brains were evolved under. Loading any file restores those settings into the controls, arms the genomes for both training and the ecosystem, and either replays them at normal speed or — if the file carries a world — puts that world back. Sandbox runs the brains open-ended with no timer: click the floor to drop food, shift+click for an obstacle.

Ecosystem — persistent biological sandbox

No fitness function. Cubes burn energy to live and to push, eat to refill it, starve at zero, die of old age at the lifespan, and bud mutated offspring when they are mature and rich. Food rains back at a fixed rate, which sets the carrying capacity. Natural selection does the rest.
World
Population
Food supply
Metabolism
Life cycle
Heredity
Carrying capacity (est.)
Food density
Run
Every file this program writes has the same shape and carries the settings that produced it — sensor spec, run config and ecosystem parameters. Any of them can be loaded to watch, to seed further training, or to seed a new ecosystem. A snapshot is simply a genome file that also carries the world, so loading one puts that world back as it was.
Census
Population
Elapsed
Food on field
Births
Deaths
Mean age at death
Lineage depth
Mean brain size
Brain resets (diverged)
Green: population. Blue: food on the field. Amber: mean lineage depth (generations since the founders). The species table above switches to the living population while the ecosystem runs — its columns become mean energy and mean age.
brain
Headless training — rendering off